<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
      <!--href="#{facesContext.externalContext.requestContextPath}/css/style.css" rel="stylesheet" type="text/css">-->
    <link rel="StyleSheet" type="text/css" href="css/home.css" media="screen" />
    <!--<f:view><f:loadBundle basename="entrada" var="entrada"/></f:view>-->
    <h:head>
        <title>..:: SAGRAU ::..</title>
        <h:outputStylesheet name="css/jsfcrud.css"/>
    </h:head>
    <h:body styleClass="body">
        <p:growl id="growl" showDetail="true" life="3000" />
        <h:form>
            <p:dialog header="SAGRAU :: Administração" id="dialog" closable="false" visible="true" resizable="false" style="text-align: center !important;">  

                <h:panelGrid columns="2" cellpadding="5">
                    <h:outputLabel for="username" value="Usuario:" />
                    <p:inputText value="#{mbLogin.login.login}" 
                                 id="username" required="true" label="username" />

                    <h:outputLabel for="password" value="Senha:" />
                    <p:password value="#{mbLogin.login.senha}"
                                id="password" rendered="true" label="password" />

                    <f:facet name="footer">
                        <p:commandButton id="loginButton" value="Login" update=":growl" 
                                         actionListener="#{mbLogin.login(actionEvent)}" 
                                         oncomplete="handleLoginRequest(xhr, status, args)"/>
                    </f:facet>

                </h:panelGrid>
            </p:dialog>
            <script type="text/javascript">
                function handleLoginRequest(xhr, status, args) {
                    if(args.validationFailed || !args.loggedIn) {
                        jQuery('#dialog').effect("shake", { times:3 }, 100);
                    } else {
                        login.hide();
                    }
                }
            </script>


        </h:form>
    </h:body>


</html>
